<template>
  <div v-loading="loading" class="list-table">
    <div class="area-header">
      <span class="area-header-title">{{ $t('合伙企业设立明细') }}</span>
    </div>
    <el-form ref="queryForm" :model="hhqyPage" :inline="true" @submit.native.prevent>
      <el-form-item :label="$t('合伙企业名称')" prop="hhqyName">
        <el-input
          v-model="hhqyPage.hhqyName"
          :placeholder="$t('合伙企业名称')"
          clearable
          @keyup.enter.native="queryHandle"
        />
      </el-form-item>
      <el-form-item>
        <el-button type="primary" icon="el-icon-search" size="mini" @click="queryHandle">{{ $t("搜索") }}</el-button>
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">{{ $t("重置") }}</el-button>
      </el-form-item>
    </el-form>
    <el-table :data="hhqyList" border>
      <el-table-column :label="$t('序号')" type="index" align="center" show-overflow-tooltip width="50">
        <template slot-scope="scope">
          {{ (hhqyPage.pageNum - 1) * hhqyPage.pageSize + scope.$index + 1 }}
        </template>
      </el-table-column>
      <el-table-column :label="$t('合伙企业名称')" prop="hhqyName" align="center" show-overflow-tooltip />
      <el-table-column :label="$t('基金管理人')" prop="gpName" align="center" show-overflow-tooltip width="110" />
      <el-table-column :label="$t('合伙企业设立时间')" prop="established" align="center" show-overflow-tooltip>
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.established) }}</span>
        </template>
      </el-table-column>
      <el-table-column :label="$t('合伙企业出资人')" prop="hhqyInvestors" align="center" show-overflow-tooltip />
      <el-table-column :label="$t('合伙企业是否备案')" prop="record" align="center" show-overflow-tooltip :formatter="recordFormat" />
    </el-table>
    <pagination
      v-show="hhqyTotal>0"
      :total="hhqyTotal"
      :page.sync="hhqyPage.pageNum"
      :limit.sync="hhqyPage.pageSize"
      @pagination="getList"
    />
  </div>
</template>

<script>
import { findEstablishDetails } from '@/api/hhqy/base/hhqyBase'
export default {
  data() {
    return {
      hhqyList: [],
      // 遮罩层
      loading: false,
      // 合伙企业查询参数
      hhqyPage: {
        hhqyName: undefined,
        pageNum: 1,
        pageSize: 10
      },
      hhqyTotal: 0,
      // 是否备案字典
      recordOptions: []
    }
  },
  created() {
    this.getList()
    this.getDicts('yes_no_record').then(response => {
      this.recordOptions = response.data
    })
  },
  methods: {
    getList() {
      this.loading = true
      findEstablishDetails(this.hhqyPage).then(response => {
        this.hhqyList = response.rows
        this.hhqyTotal = response.total
        this.loading = false
      })
    },
    /** 搜索按钮操作 */
    queryHandle() {
      this.hhqyPage.pageNum = 1
      this.getList()
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm('queryForm')
      this.queryHandle()
    },
    // 是否分给配LP 系统是否字典翻译
    recordFormat(row) {
      return this.selectDictLabel(this.recordOptions, row.record)
    }
  }
}
</script>

<style scoped>

</style>
